
#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1

int main() {
    int i;
    int seed = 1000;
    int numPlayer = 2;
    int r;
    int loopCount = 10;
    int k[10] = {adventurer, council_room, feast, gardens, mine
               , remodel, smithy, village, baron, great_hall};
    struct gameState G;
    int result;
    int player = 0;
    int hand = 1;
    int bonus = 0;
    int numberCards;
    int startingDeckCount = 0;
    int endingDeckCount = 0;   

    
    
#if (NOISY_TEST == 1)
                printf ("TESTING cardEffect smithy():\n"); // testing for number of cards and that the deck count changes
                
#endif
        for(i = 0; i < loopCount; i++){
                memset(&G, 23, sizeof(struct gameState));   // clear the game state
                r = initializeGame(numPlayer, k, seed, &G); // initialize a new game

                startingDeckCount = G.deckCount[player];

                result=cardEffect(smithy, 0, 0, 0, &G, hand, &bonus);
                numberCards = *G.handCount;                 // set the number of cards on hand
                
                endingDeckCount = G.deckCount[player];

#if (NOISY_TEST == 1)
                printf("Number of Cards = %d, expected = %d\n", numberCards, 3);
#endif
                assert(numberCards = 3); // check if the number of cards is correct, should be +2 because you add 3 minus the 1 played

#if (NOISY_TEST == 1)
                printf("Number of cards in deck = %d, expected = %d\n", endingDeckCount, (startingDeckCount - 3));
#endif
                assert(endingDeckCount = (startingDeckCount -3)); // check if the number of ending cards in the deck is correct
                
        }
    printf("All tests passed!\n");

    return 0;
}
